#include <lvgl.h>
#include <WiFi.h>
#include <Preferences.h>
#include "../../common.h"
#include "SD.h"

extern const lv_img_dsc_t file_icon;

class FileSystem
{
  private:
  char buf[128];
  
  String cur_path = "";
  Event event;
  bool is_input=true;
  lv_obj_t *label_scr, *label_msg, *label_sym, *label_ssid;
  lv_style_t font_style;
  int timecal;
  uint8_t num_sta = 0, tem_num_sta = 0;
  bool is_connected;
  String ssid;
  WiFiServer* server;
  WiFiClient client;
  bool is_con=false;
  String ip;
  Preferences save_cfg;


  void listDir(const char* dirname);
  void createDir( const char* path);
  void removeDir(  const char* path);
  void readFile(  const char* path);
  String readFileLine( const char* path, int num);
  void createFile(const char* path);
  void renameFile(const char* path1, const char* path2);
  void deleteFile(const char* path);
  void deleteallFile(const char* path);
  void get_command();
  void get_sd_message();
  void command_base(String);
  void recv_file(String);
  void command_setting(String);

  void init_gui();
  void show_msg(String, String, String);
  
  public:
  FileSystem();
  ~FileSystem();
  Event main_process(Action);
    

};
